//
//  VideoCell.m
//  Mango
//
//  Created by lanou3g on 16/5/6.
//  Copyright © 2016年 lanou3g. All rights reserved.
//

#import "VideoCell.h"

@interface VideoCell ()
@property (weak, nonatomic) IBOutlet UILabel *titleLabel;
@property (weak, nonatomic) IBOutlet UIImageView *coverImageView;
@property (weak, nonatomic) IBOutlet UILabel *readnumLabel;

@end


@implementation VideoCell
- (IBAction)playBtn:(UIButton *)sender {
    
    if ([self.delegate respondsToSelector:@selector(clickVideoButton:)]) {
        [self.delegate clickVideoButton:self.indePath];
    }
    
}


- (void)setModel:(VideoModel *)model {
    if (_model != model) {
        _model = model;
        self.titleLabel.text = model.title;
        NSString *orignStr = model.pic;
        NSArray *strArray = [orignStr componentsSeparatedByString:@"!"];
        [self.coverImageView sd_setImageWithURL:[NSURL URLWithString:strArray[0]]];
        self.readnumLabel.text = [NSString stringWithFormat:@"视频 / 阅读%ld",model.readnum];
    }
}

- (void)setFrame:(CGRect)frame {
    frame.origin.y += 8;
    frame.size.height -= 8;
    [super setFrame:frame];
}


#pragma mark 切换至日间模式
-(void)updateToDaySkinMode {
    self.titleLabel.textColor = [UIColor blackColor];
    self.readnumLabel.textColor = [UIColor blackColor];
    self.contentView.backgroundColor = [UIColor whiteColor];
}

#pragma mark 切换至夜间模式
-(void)updateToNightSkinMode {
    self.titleLabel.textColor = [UIColor grayColor];
    self.readnumLabel.textColor = [UIColor grayColor];
    self.contentView.backgroundColor = [UIColor colorWithRed:42/255.0 green:39/255.0 blue:43/255.0 alpha:1.0];
}


- (void)awakeFromNib {
    // Initialization code
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
